import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;


public class Controler extends KeyAdapter {
	
	private MoveFrame frame;
	private int mouv = 20;
	
	public Controler (MoveFrame f){
		this.frame = f;
	}
	public void keyPressed(KeyEvent e){

		switch(e.getKeyCode()){
		case KeyEvent.VK_RIGHT:
			frame.deplacer(frame.X + mouv, frame.Y);
			break;
		case KeyEvent.VK_LEFT:
			frame.deplacer(frame.X - mouv, frame.Y);
			break;
		case KeyEvent.VK_UP:
			frame.deplacer(frame.X , frame.Y - mouv);
			break;
		case KeyEvent.VK_DOWN:
			frame.deplacer(frame.X, frame.Y + mouv);
			break;
		}
	}		
}
